package pers.jason.wppm.auth.api.dto;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotBlank;
import pers.jason.wppm.api.support.Regular;
import pers.jason.wppm.auth.api.enums.LoginType;
import pers.jason.wppm.auth.api.validate.EnumIn;

import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

/**
 * @ClassName: AuthenticationCondition
 * @Author: JZH
 * @Date: 2018/12/25 13:55
 */
@Data
public class AuthenticationCondition {

    @NotBlank(message = "需要指定登录方式")
    @ApiModelProperty(value = "登录方式，手机号、邮箱、账号密码")
    @EnumIn(enumType = LoginType.class, message = "loginType不正确的枚举值")
    private String loginType;

    @ApiModelProperty(value = "手机号")
    @Pattern(regexp = Regular.REP_MOBILE, message = "手机号码格式错误")
    private String mobile;

    @ApiModelProperty(value = "邮箱")
    @Email(message = "邮箱地址格式错误")
    private String email;

    @ApiModelProperty(value = "登录名")
    @Size(min = 4, max = 10, message = "登录名长度在4~10位之间")
    private String loginName;

}
